//
//  XBTaglist.m
//  xunbao
//
//  Created by 程顺晓 on 16/4/10.
//  Copyright © 2016年 itcast. All rights reserved.
//

#import "XBTaglist.h"
#import "AFHTTPSessionManager.h"
#import "NSObject+Model.h"

@implementation XBTaglist

+ (void)loadUrlStringsuccess:(void(^)(NSArray *arr))success {
    
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    
    [manager GET:@"http://api.xunbaozl.com/v2/post/loadAuction?" parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, NSDictionary *responseObject) {
        
        // 取得第一个主key
        NSString *keyMain = responseObject.keyEnumerator.nextObject;
        NSDictionary *dic = responseObject[keyMain];

        NSArray *keys = dic.keyEnumerator.allObjects;
        NSString *tagListKey = keys[0];
        NSArray *tagArr = dic[tagListKey];
        
        
        
        success(tagArr.copy);
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"%@",error);
    }];
}

@end
